package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.view.personal.setup.UpdatePhoneActivity;

/**
 * author : 许建宏
 * Date: 2017/10/20 0020
 * View:修改手机号码
 */

public class UpdatePhonePresenter {

    private RequestModel requestModel;
    private UpdatePhoneActivity updatePhoneActivity;

    public UpdatePhonePresenter(UpdatePhoneActivity updatePhoneActivity){
        this.requestModel=new RequestModel();
        this.updatePhoneActivity=updatePhoneActivity;
    }

    public void UpdatePhoneOperation(final String name){

        requestModel.PostUpPhone(name, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                updatePhoneActivity.onSuccess(data);
            }

            @Override
            public void onError(String msg) {
                updatePhoneActivity.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                updatePhoneActivity.onRefreshUI();
            }
        });
    }
}
